Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow optional acap property - sampling_rate #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shantur
Copy link

@shantur shantur commented Feb 15, 2025

This is needed when using audio capture from a device other than tc358743 such as a UAC2 Capture device to have two way audio over USB

When sampling_rate is provided, janus plugin don't try to query tc358743

@shantur
Copy link
Author

shantur commented Feb 15, 2025

With this change, one can create UAC2 capture device for audio input rather than using HDMI->CSI2 -> I2S audio

Setup

rw
git clone https://github.com/shantur/ustreamer.git
cd ustreamer
git checkout feature/provide_acap_sampling_rate

Compile with commands

rw
pacman -S libdrm janus-gateway-pikvm alsa-lib opus speexdsp
WITH_V4P=1 WITH_GPIO=1 WITH_SYSTEMD=1 WITH_JANUS=1 make
cp libjanus_ustreamer.so /usr/lib/ustreamer/janus/libjanus_ustreamer.so

Sample configs that I tested with

/etc/kvmd/janus/janus.plugin.ustreamer.jcfg

video: {
	sink = "kvmd::ustreamer::h264"
}
acap: {
	device = "plughw:UAC2Gadget,0"
	tc358743 = "/dev/kvmd-video"
    sampling_rate = 48000
}
aplay: {
	device = "plughw:UAC2Gadget,0"
	check = "/run/kvmd/otg/uac2.usb0@meta.json"
}

Replace - https://github.com/pikvm/kvmd/blob/master/kvmd/apps/otg/__init__.py#L119

with

        _write(join(func_path, "c_chmask"), 0b11)
        _write(join(func_path, "c_srate"), 48000)
        _write(join(func_path, "c_ssize"), 2)

Enable microphone as in - https://docs.pikvm.org/audio/#speakers-incoming-audio

shantur added a commit to shantur/kvmd that referenced this pull request Feb 16, 2025
Along with pikvm/ustreamer#304 this
allows audio capture with hdmiusb devices and HDMI->CSI Bridges without adding any more cables.
shantur added a commit to shantur/kvmd that referenced this pull request Feb 16, 2025
Along with pikvm/ustreamer#304 this
allows audio capture with hdmiusb devices and HDMI->CSI Bridges without adding any more cables.
This is needed when using audio capture from a device other than tc358743
such as a UAC2 Capture device to have two way audio over USB

When sampling_rate is provided, janus plugin don't try to query tc358743
@shantur shantur force-pushed the feature/provide_acap_sampling_rate branch from 3ea13e3 to 4f78bc8 Compare March 3, 2025 09:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant